class: center, middle, inverse, title-slide .title[ # The Whiz and Viz Bang of Data ] .subtitle[ ## The Basics of Visualizaiton and Modeling (part deux) ] .author[ ### Dr. Christopher Kenaley ] .institute[ ### Boston College ] .date[ ### 2024/9/20 ] --- class: inverse, top # In class today <!-- qAdd icon library --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css"> .pull-left[ Today we'll .... - Consider a little history - Consider the effect of phylogeny ] .pull-right[  ] --- class: inverse, top # First, some history .pull-left[ The comparative method: - Documenting diversity of traits - Quantifying their intercorrelations - Speculating on their evolution Before Felsenstein (1985), no theoretical method to account for phylogeny and this effect was largely ignored of explained away. ] .pull-right[ Cited >10000 times!!!  ] --- class: inverse, top ## Before Felsenstein (1985) .pull-left[ - Sample a breadth of species - Document the phenotype (e.g., Met. rate vs. size) - Quantifying the contrast or trend between them (ANOVA, T-test, etc.) <!-- --> ] .pull-right[ ``` ## `geom_smooth()` using formula = 'y ~ x' ``` <!-- --> ``` ## # A tibble: 2 × 3 ## term statistic p.value ## <chr> <dbl> <dbl> ## 1 log(mass) 14.4 0.00134 ## 2 Residuals NA NA ``` ] --- class: inverse, top ## After Felsenstein (1985) .pull-left[ ``` r mass.pic <- pic(log(mass),phy) met.pic <- pic(log(met),phy) qplot(mass.pic,met.pic)+geom_smooth(method = "lm")+theme_classic(20) ``` <!-- --> ] .pull-right[ ``` r d.lm.pic <- lm(met.pic~mass.pic) tidy(anova(d.lm.pic))[,c(1,5,6)] ``` ``` ## # A tibble: 2 × 3 ## term statistic p.value ## <chr> <dbl> <dbl> ## 1 mass.pic 0.0191 0.892 ## 2 Residuals NA NA ``` ] --- class: inverse, top ## After Felsenstein (1985) .pull-left[ Metabolic Rate <!-- --> ] .pull-right[ Mass <!-- --> ] --- class: inverse, top <!-- slide 1 --> ## Humble beginnings > This paper addresses a complex and important issue, and provides a solution to part of the problem—a very unsatisfactory solution, as the author is well aware, given the degree to which our data will usually fall short of the quality required by the method he proposes. … Nevertheless, as far as I can tell the method does what is claimed, and it is probably worth publishing. -Anonymous reviewer of Felsenstein (1985) --- class: inverse, top <!-- slide 1 --> ## More complex models ### Brownian motion <center>  </center> <br> `\(\sigma^2\)` the rate parameter --- class: inverse, top <!-- slide 1 --> ## More complex models <!-- --> --- class: inverse, top <!-- slide 1 --> ## More complex models ### OU process .pull-left[ <center>  </center> <br> ] .pull-right[ `\(\sigma^2\)` the rate parameter `\(\theta\)` trait optimum `\(\alpha\)` strength of selection ] --- class: inverse, top <!-- slide 1 --> ## More complex models ### Phylogenetic Least Squares Models that include process (mode) and relationships ``` r # PGLS under BM, gls(y ~ x, correlation = corBrownian(1, phy = tree, form = ~Species), data = data, method = "ML") # PGLS under OU pgls.OU1 <- gls(y ~ x, correlation = corMartins(0, phy = tree, form = ~Species), data = dat, method = "ML") ```